package com.wjpeng.wms.service.impl;

import com.wjpeng.wms.mapper.ProductStockMapper;
import com.wjpeng.wms.mapper.PermissionMapper;
import com.wjpeng.wms.query.ProductStockQueryObject;
import com.wjpeng.wms.service.IProductStockService;
import com.wjpeng.wms.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;

@Service
public class ProductStockServiceImpl implements IProductStockService {
    @Autowired
    private ProductStockMapper productStockMapper;

    @Override
    public PageResult result(ProductStockQueryObject qo) {
        Integer count = productStockMapper.queryCount(qo);
        if(count == 0){
            return new PageResult(Collections.EMPTY_LIST,0,1,0);
        }
        return new PageResult(productStockMapper.queryLimit(qo),count,qo.getCurrentPage(),qo.getPageSize());
    }

}
